package com.malty.mall.domain.dto.req;

import com.malty.mall.domain.entity.ums.UmsResource;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

/**
 * @author malty
 */
@Data
@ApiModel("资源参数")
@NoArgsConstructor
public class UmsResourceParam {
    private Integer id;
    @ApiModelProperty("资源名称")
    @NotEmpty(message = "资源名称必填")
    private String name;
    @ApiModelProperty("资源路径")
    @NotEmpty(message = "资源路径必填")
    private String path;
    @ApiModelProperty("资源描述")
    @NotEmpty(message = "资源描述必填")
    private String note;
    @ApiModelProperty("资源类型")
    @NotNull(message = "资源类型必填")
    private Integer typeId;

    public UmsResourceParam(UmsResource umsResource) {
        BeanUtils.copyProperties(umsResource, this);
    }
}
